import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";

var _dec, _dec2, _dec3, _class, _class2;

import React, { Component, Fragment } from 'react';
import { Tooltip, Button, Modal } from 'antd';
import { Bind } from 'lodash-decorators';
import formatterCollections from "../../../utils/intl/formatterCollections";
import intl from "../../../utils/intl";
import CustModal from "./CustModal";
import styles from "./style.less?modules";
var CustButton = (_dec = formatterCollections({
  code: ['hcuz.custButton']
}), _dec2 = Bind(), _dec3 = Bind(), _dec(_class = (_class2 = /*#__PURE__*/function (_Component) {
  _inherits(CustButton, _Component);

  var _super = _createSuper(CustButton);

  function CustButton() {
    var _this;

    _classCallCheck(this, CustButton);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));
    _this.state = {
      modalVisible: false
    };
    return _this;
  }

  _createClass(CustButton, [{
    key: "closeModal",
    value: function closeModal() {
      this.setState({
        modalVisible: false
      });
    }
  }, {
    key: "openCustModal",
    value: function openCustModal() {
      this.setState({
        modalVisible: true
      });
    }
  }, {
    key: "render",
    value: function render() {
      var modalVisible = this.state.modalVisible;
      var _this$props$unit = this.props.unit,
          unit = _this$props$unit === void 0 ? [] : _this$props$unit;
      return /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
        placement: "bottom",
        title: intl.get('hcuz.custButton.view.message.individuation').d('个性化')
      }, /*#__PURE__*/React.createElement(Button, {
        icon: "setting",
        className: styles.settings,
        onClick: this.openCustModal
      })), /*#__PURE__*/React.createElement(Modal, {
        visible: modalVisible,
        title: intl.get('hcuz.custButton.view.button.individuation').d('个性化'),
        width: 1000 // maskStyle={{ zIndex: 100 }}
        // wrapClassName={styles['cust-modal-wrap']}
        ,
        destroyOnClose: true,
        maskClosable: false,
        className: styles['cust-modal'],
        footer: null,
        onCancel: this.closeModal
      }, /*#__PURE__*/React.createElement(CustModal, {
        unit: unit,
        handleClose: this.closeModal
      })));
    }
  }]);

  return CustButton;
}(Component), (_applyDecoratedDescriptor(_class2.prototype, "closeModal", [_dec2], Object.getOwnPropertyDescriptor(_class2.prototype, "closeModal"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "openCustModal", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "openCustModal"), _class2.prototype)), _class2)) || _class);
export { CustButton as default };